package com.admin.client.mvc.views;

import com.admin.client.components.MenuPanel;
import com.admin.client.mvc.controllers.UsuarioController;
import com.admin.client.mvc.events.AppEvents;
import com.extjs.gxt.ui.client.event.EventType;
import com.extjs.gxt.ui.client.mvc.AppEvent;
import com.extjs.gxt.ui.client.mvc.View;
import com.extjs.gxt.ui.client.widget.TabItem;


public class UsuarioView extends View {

	public UsuarioView(UsuarioController usuarioController) {
		super(usuarioController);
	}

	@Override
	protected void handleEvent(AppEvent event) {
		EventType eventType = event.getType();
		if(eventType.equals(AppEvents.UsuarioReady)){
			onUsuarioReady(event);
		}
	}

	private void onUsuarioReady(AppEvent event) {		
		TabItem tabItem = event.getData();
		MenuPanel menupanel = new MenuPanel();
		
		//solo si implementa la interfaz permisos
		//Dispatcher.forwardEvent(new AppEvent(AppEvents.Permisos, menupanel));
		
		tabItem.add(menupanel);
	}

}
